package com.itheima.dao;


import com.itheima.domian.Order;
import com.itheima.domian.User;
import org.apache.ibatis.annotations.One;
import org.apache.ibatis.annotations.Result;
import org.apache.ibatis.annotations.Results;
import org.apache.ibatis.annotations.Select;

import java.util.List;

public interface OrderMapper {


    @Select("select * from orders ")
    @Results({
            @Result(id = true, property = "id", column = "id"),
            @Result(property = "ordertime", column = "ordertime"),
            @Result(property = "total", column = "total"),
            @Result(
                    property = "user", //要封装的属性名称  private User user;
                    javaType = User.class, //要封装的实体类型
                    column = "uid", //根据那个字段去查询user表的数据
                    //select属性 代表查询那个接口的方法获得数据
                    one = @One(select = "com.itheima.dao.UserMapper.findById")
            )
    })
    public List<Order> findAll();
}
